function register() {
  const user = document.getElementById("regUser").value;
  const pass = document.getElementById("regPass").value;
  const email = document.getElementById("regEmail").value;
  localStorage.setItem(user, JSON.stringify({ email, pass }));
  alert("注册成功！");
}

function login() {
  const user = document.getElementById("loginUser").value;
  const pass = document.getElementById("loginPass").value;
  const data = JSON.parse(localStorage.getItem(user));
  const status = document.getElementById("status");
  if (data && data.pass === pass) {
    status.innerText = `欢迎，${user}！`;
  } else {
    status.innerText = "用户名或密码错误！";
  }
}
